<?php

namespace App\Http\Controllers\Index;

use Illuminate\Http\Request;
use App\Model\Common\Project;
use App\Http\Controllers\Common\CommonController;

class ProjectController extends CommonController
{
    public function index(Request $request)
    {
        $perpage = $request->input('per_page') ?: (empty($this->perpage) ? 4 : $this->perpage);
        $m = new Project();
        $list = $m->where('status',1)->orderBy('rank', 'desc')->paginate($perpage);
        //print_r($list);
        if (method_exists($m, 'listDataFormat')) {
            $list = $m->listDataFormat($list);
        }
        $this->assign('list', $list);
        $this->assignSiteInfo('project/index');
        return $this->fetch();
    }
}
